﻿<UserControl x:Class="Big3.Hitbase.MainControls.AlbumViewTable"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:misc="clr-namespace:Big3.Hitbase.Miscellaneous;assembly=Misc"      
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:sr="clr-namespace:Big3.Hitbase.SharedResources;assembly=Big3.Hitbase.SharedResources"
             xmlns:controls="clr-namespace:Big3.Hitbase.Controls;assembly=Controls"
             xmlns:dd="clr-namespace:Big3.Hitbase.Controls.DragDrop;assembly=Controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Unloaded="UserControl_Unloaded">
    <UserControl.Resources>
        <misc:SingleLineConverter x:Key="singlelineConverter" />

        <Style x:Key="MultilineButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" >
        </Style>

        <DataTemplate x:Key="CommentTemplate">
            <DockPanel MouseEnter="DockPanelMultiLineEdit_MouseEnter" MouseLeave="DockPanelMultiLineEdit_MouseLeave">
                <Button Name="MultiLineEditButton" Visibility="Collapsed" DockPanel.Dock="Right" Click="ButtonMultiLineEdit_Click" Background="Transparent" Style="{StaticResource MultilineButtonStyle}" >
                    <Image Height="11" Width="11" Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/edit.png"></Image>
                </Button>
                <TextBlock Margin="1" Text="{Binding Comment, Converter={StaticResource singlelineConverter}}" TextTrimming="CharacterEllipsis" />
            </DockPanel>
        </DataTemplate>
    </UserControl.Resources>
    <UserControl.CommandBindings>
        <CommandBinding Command="sr:HitbaseCommands.CopyToClipboard" Executed="CommandBindingCopyToClipboard_Executed" />
    </UserControl.CommandBindings>
    <DataGrid CanUserAddRows="False" CanUserResizeRows="False" CanUserDeleteRows="False" BorderThickness="0" HeadersVisibility="Column" ColumnReordered="dataGrid_ColumnReordered"
              PreviewMouseLeftButtonUp="dataGrid_PreviewMouseLeftButtonUp" 
              SelectionUnit="FullRow" EnableRowVirtualization="True" 
              RowHeaderWidth="0" AutoGenerateColumns="False" Name="dataGrid" Background="Transparent" PreviewMouseDoubleClick="dataGrid_PreviewMouseDoubleClick" CellEditEnding="dataGrid_CellEditEnding"
              Sorting="dataGrid_Sorting" dd:DragDrop.IsDragSource="true" dd:DragDrop.IsDropTarget="false" >
        <DataGrid.InputBindings>
            <KeyBinding Command="sr:HitbaseCommands.DeleteAlbum" Key="Delete" />
        </DataGrid.InputBindings>

        <DataGrid.ContextMenu>
            <ContextMenu DataContext="{Binding RelativeSource={RelativeSource Mode=Self}, Path=PlacementTarget}">
                <ContextMenu.CommandBindings>
                    <CommandBinding Command="sr:HitbaseCommands.ChooseColumns" Executed="CommandBindingChooseColumns_Executed" />
                    <CommandBinding Command="sr:HitbaseCommands.Rename" Executed="CommandBindingRename_Executed" />
                </ContextMenu.CommandBindings>
                <MenuItem Header="Löschen" Command="sr:HitbaseCommands.DeleteAlbum" CommandParameter="{Binding SelectedItems}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/delete.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Umbenennen" Command="sr:HitbaseCommands.Rename">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/Rename.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Ins CD-Archiv übertragen" Command="sr:HitbaseCommands.SendCDToCDArchive" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/SendToInternet.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Verliehen..." Command="sr:HitbaseCommands.CDLoaned" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/LoanCD.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Sofort spielen" Command="sr:HitbaseCommands.AddAlbumToPlaylistNow" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/PlayNowBlack.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Als nächstes spielen" Command="sr:HitbaseCommands.AddAlbumToPlaylistNext" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/PlayNextBlack.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Als letztes spielen" Command="sr:HitbaseCommands.AddAlbumToPlaylistLast" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/PlayLastBlack.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Drucken" Command="sr:HitbaseCommands.PrintAlbum" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/Print.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="In die Zwischenablage kopieren" Command="sr:HitbaseCommands.CopyToClipboard">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/Copy.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Schreibweise anpassen" Command="sr:HitbaseCommands.AdjustSpelling" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/AdjustSpelling.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Spalten wählen..." Command="sr:HitbaseCommands.ChooseColumns">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/ChooseColumns.png" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Eigenschaften" Command="sr:HitbaseCommands.OpenAlbum" CommandParameter="{Binding SelectedItem.ID}">
                    <MenuItem.Icon>
                        <Image Width="16" Height="16" Source="/Big3.Hitbase.SharedResources;component/Images/Properties.png" />
                    </MenuItem.Icon>
                </MenuItem>
            </ContextMenu>
        </DataGrid.ContextMenu>
    </DataGrid>
</UserControl>
